/**
 * 品牌商标数据接口
 */
export interface BrandItem {
  id: number
  brandName: string
  brandLogo: string
  status: 'active' | 'inactive'
  createTime: string
}

/**
 * 品牌商标模拟数据
 */
export const trademarkData: BrandItem[] = [
  {
    id: 1,
    brandName: 'Nike',
    brandLogo: 'https://logos-world.net/wp-content/uploads/2020/04/Nike-Logo.png',
    status: 'active',
    createTime: '2024-01-15 10:30:00'
  },
  {
    id: 2,
    brandName: 'Adidas',
    brandLogo: 'https://logos-world.net/wp-content/uploads/2020/04/Adidas-Logo.png',
    status: 'active',
    createTime: '2024-01-16 14:20:00'
  },
  {
    id: 3,
    brandName: 'Puma',
    brandLogo: 'https://logos-world.net/wp-content/uploads/2020/04/Puma-Logo.png',
    status: 'inactive',
    createTime: '2024-01-17 09:15:00'
  },
  {
    id: 4,
    brandName: 'Reebok',
    brandLogo: 'https://logos-world.net/wp-content/uploads/2020/04/Reebok-Logo.png',
    status: 'active',
    createTime: '2024-01-18 16:45:00'
  },
  {
    id: 5,
    brandName: 'Fila',
    brandLogo: 'https://logos-world.net/wp-content/uploads/2020/04/Fila-Logo.png',
    status: 'active',
    createTime: '2024-01-19 11:30:00'
  },
  {
    id: 6,
    brandName: 'Under Armour',
    brandLogo: 'https://logos-world.net/wp-content/uploads/2020/04/Under-Armour-Logo.png',
    status: 'active',
    createTime: '2024-01-20 08:45:00'
  },
  {
    id: 7,
    brandName: 'New Balance',
    brandLogo: 'https://logos-world.net/wp-content/uploads/2020/04/New-Balance-Logo.png',
    status: 'active',
    createTime: '2024-01-21 13:20:00'
  },
  {
    id: 8,
    brandName: 'Converse',
    brandLogo: 'https://logos-world.net/wp-content/uploads/2020/04/Converse-Logo.png',
    status: 'inactive',
    createTime: '2024-01-22 15:10:00'
  },
  {
    id: 9,
    brandName: 'Vans',
    brandLogo: 'https://logos-world.net/wp-content/uploads/2020/04/Vans-Logo.png',
    status: 'active',
    createTime: '2024-01-23 09:30:00'
  },
  {
    id: 10,
    brandName: 'ASICS',
    brandLogo: 'https://logos-world.net/wp-content/uploads/2020/04/ASICS-Logo.png',
    status: 'active',
    createTime: '2024-01-24 12:15:00'
  },
  {
    id: 11,
    brandName: 'Jordan',
    brandLogo: 'https://logos-world.net/wp-content/uploads/2020/04/Jordan-Logo.png',
    status: 'active',
    createTime: '2024-01-25 14:40:00'
  },
  {
    id: 12,
    brandName: 'Skechers',
    brandLogo: 'https://logos-world.net/wp-content/uploads/2020/04/Skechers-Logo.png',
    status: 'inactive',
    createTime: '2024-01-26 10:25:00'
  },
  {
    id: 13,
    brandName: 'Timberland',
    brandLogo: 'https://logos-world.net/wp-content/uploads/2020/04/Timberland-Logo.png',
    status: 'active',
    createTime: '2024-01-27 16:50:00'
  },
  {
    id: 14,
    brandName: 'Columbia',
    brandLogo: 'https://logos-world.net/wp-content/uploads/2020/04/Columbia-Logo.png',
    status: 'active',
    createTime: '2024-01-28 11:35:00'
  },
  {
    id: 15,
    brandName: 'The North Face',
    brandLogo: 'https://logos-world.net/wp-content/uploads/2020/04/The-North-Face-Logo.png',
    status: 'active',
    createTime: '2024-01-29 13:45:00'
  },
  {
    id: 16,
    brandName: 'Patagonia',
    brandLogo: 'https://logos-world.net/wp-content/uploads/2020/04/Patagonia-Logo.png',
    status: 'inactive',
    createTime: '2024-01-30 09:20:00'
  },
  {
    id: 17,
    brandName: 'Salomon',
    brandLogo: 'https://logos-world.net/wp-content/uploads/2020/04/Salomon-Logo.png',
    status: 'active',
    createTime: '2024-01-31 15:30:00'
  },
  {
    id: 18,
    brandName: 'Merrell',
    brandLogo: 'https://logos-world.net/wp-content/uploads/2020/04/Merrell-Logo.png',
    status: 'active',
    createTime: '2024-02-01 12:10:00'
  },
  {
    id: 19,
    brandName: 'Keen',
    brandLogo: 'https://logos-world.net/wp-content/uploads/2020/04/Keen-Logo.png',
    status: 'active',
    createTime: '2024-02-02 14:55:00'
  },
  {
    id: 20,
    brandName: 'Crocs',
    brandLogo: 'https://logos-world.net/wp-content/uploads/2020/04/Crocs-Logo.png',
    status: 'inactive',
    createTime: '2024-02-03 10:40:00'
  }
]

/**
 * 获取品牌列表数据
 * @param params 查询参数
 * @returns 品牌列表数据
 */
export const getTrademarkList = (params?: {
  brandName?: string
  status?: string
  currentPage?: number
  pageSize?: number
}) => {
  let filteredData = [...trademarkData]

  // 按品牌名称过滤
  if (params?.brandName) {
    filteredData = filteredData.filter(item =>
      item.brandName.toLowerCase().includes(params.brandName!.toLowerCase())
    )
  }

  // 按状态过滤
  if (params?.status) {
    filteredData = filteredData.filter(item => item.status === params.status)
  }

  // 分页处理
  const currentPage = params?.currentPage || 1
  const pageSize = params?.pageSize || 10
  const total = filteredData.length
  const start = (currentPage - 1) * pageSize
  const end = start + pageSize
  const list = filteredData.slice(start, end)

  return {
    code: 200,
    message: 'success',
    data: {
      list,
      total,
      currentPage,
      pageSize
    }
  }
}